import java.math.BigDecimal;
import java.util.Scanner;
import java.util.*;

public class MC0332简单的进制转换 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        // code here
        String s = input.nextLine();
        System.out.println(Integer.parseInt(s,2));
        int sum = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            sum = sum * 2;
            if (c == '1') {
                sum += 1;
            }
        }
        System.out.println(sum);
        input.close();
    }
}
